package com.vichat.common.vo;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Created by Ranjx on 2018/8/7.
 */
public class BeaconHashMap {
    public static ConcurrentHashMap<String,List<BeaconVO>> list = null;

    static {
        list = new ConcurrentHashMap<>();
    }

    public synchronized static List<BeaconVO> getList() {
        if(!list.isEmpty()){
            for (Map.Entry<String, List<BeaconVO>> entry : list.entrySet()) {
                del(entry.getKey());
                return entry.getValue();
            }
        }
        return null;
    }

    public synchronized static void add(List<BeaconVO> val) {
        list.put(UUID.randomUUID().toString(),val);
    }

    public synchronized static void del(String key) {
        list.remove(key);
    }
}
